<?php
    apf_require_class("PageHelper");
    $img_path = '/img/home/';
    ?>

<div class="header">
    <div class="bg_top"></div>
    <div class="logo"></div>
</div>

<div class="container">
<div class="topic"><span class="a1">&nbsp;</span><a href="<?=Flow_Urls::flow_list_key()?>" class="<?=$data['is_list'] ? "uneed":"need"?>"  >生成密码</a><a href="<?=Flow_Urls::flow_list_key()?>?do=list" class="<?=$data['is_list'] ? "need":"uneed"?>">历史记录</a><span class="a2">&nbsp;</span>
</div>

<?php if($params['do']=='list') {?>
<div class="container">
<form id="form1" action="<?=Flow_Urls::flow_list_key()?>?do=list" method="post" style="width: 837px;">
<div class="h">
            <span>
                <input type="text" name="user_name" value="<?=$params['user_name']?>" placeholder="请输入姓名"/>
            </span>
            <span>
                <input type="text" name="user_code" value="<?=$params['user_code']?>" placeholder="请输入工号"/>
            </span>
            <span><input type="text" class="time date" id="entry_date" name="start" value="<?=$params['start']?>"/></span><span>至</span>
            <span><input type="text" class="time date" id="entry_date_1" name="end" value="<?=$params['end']?>"/></span>
            <span><input type="submit" value="查询" class="button"/></span>
    </div>
<table cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
    <th>生成日期</th>
    <th>姓名</th>
    <th>工号</th>
    <th>职位</th>
    <th>部门</th>
</tr>
</thead>
    <tbody>
    <?php foreach($data['list'] as $info) {?>
        <tr>
            <td><?=date('Y-m-d',$info['last_update'])?></td>
            <td><?=$info['user_name']?></td>
            <td><?=$info['user_code']?></td>
            <td><?=$info['position_name']?></td>
            <td><?=$info['department_name']?></td>
        </tr>
    <?php }?>
    </tbody>
</table>
</form>
<div class="footer">
<?php if(isset($data['multipage']) && !empty($data['multipage']['list'])) {?>
<?php $this->component('Flow_MultiPage', array('multipage'=>$data['multipage'])); ?>
<?php } ?>
</div>
</div>
<?php }else {?>
<form id="form1" action="<?=Flow_Urls::flow_list_key()?>" method="post" style="width: 837px;">
    <input name="code" style="margin-left: 60px;margin-top: 20px;" type="text" placeholder="请输入工号"/>
    <input type="submit" value="查询" class="button"/><br/>
</form>
<form id="form2" action="<?=Flow_Urls::flow_list_key()?>?do=create" method="post" >
    <?php $data['error'] = trim($data['error']);if(empty($data['error']) && (!empty($data['user_id']) && !empty($data['user_name']))) {?>
    <label class="per_msg name"><?=$data['user_name']?>-<?=$data['user_code']?></label>
    <label class="per_msg" style="margin-left: 60px;">职位：<?=$data['position_name']?></label>
    <label class="per_msg" style="margin-left: 30px;">部门：<?=$data['department_name']?></label>
    <input type="hidden" name="user_id" value="<?=$data['user_id']?>"/>
    <input type="hidden" name="user_name" value="<?=$data['user_name']?>"/>
    <?php if(!isset($data['create_status'])) {?>
    <input type="submit" value="" class="pwd_create"/>
    <?php }else{?>
        <div style="padding-left:60px;padding-top:30px;">成功生成密码！已发送密码至邮箱！</div>
    <?php }?>
    <?php }else if(!empty($data['msg'])){?>
    <div style="padding-left:60px;color:red;padding-top:5px;">* <?=$data['msg']?></div>
    <?php }?>
</form>
<?php }?>

</div>
